package day1027_3;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class ReadNote {
    public static void main(String[] args) {
        FileInputStream fis=null;
        try {
            fis=new FileInputStream("note.txt");
            //1.创建FileInputStream对象  fis

            //System.out.println((char)fis.read());
            int length=-1;
            byte[]  bs=new byte[1024];
            while(  (length=fis.read(bs))!=-1 ){ //2.fis.read()//System.out.println((char)fis.read());//根据微信的图片将这个read()放入while循环中就可以读取整篇小说
                System.out.println(new String(bs));
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fis.close();//3.fis.close()： 关闭fis(释放note.txt)   finally中
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}


